﻿using System;
using StarClub.Model;

namespace StarClub.BLL.PageBase
{
    /// <summary>
    /// 基本页面继承类
    /// </summary>
    public class PageBase : System.Web.UI.Page
    {
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            //用于google流量分析统计
            /*string googleAnalytics = @"<script type=""text/javascript"">
                                        var gaJsHost = ((""https:"" == document.location.protocol) ? ""https://ssl."" : ""http://www."");
                                        document.write(unescape(""%3Cscript src='"" + gaJsHost + ""google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E""));
                                        </script>
                                        <script type=""text/javascript"">
                                        try {
                                        var pageTracker = _gat._getTracker(""UA-9711637-1"");
                                        pageTracker._trackPageview();
                                        } catch(err) {}</script>";
            this.ClientScript.RegisterStartupScript(this.GetType(), "googleAnalytics", googleAnalytics);*/
        }
        public StarClub.Model.star_user UserInfo
        {
            get
            {
                if (Session[SystemDefinition.SystemUser] != null)
                    return (StarClub.Model.star_user)Session[SystemDefinition.SystemUser];
                else
                    Server.Transfer("~/Error.aspx?t=登录超时&msg=登录超时，请重新登录");
                return null;

            }
        }
        public bool IsLogined
        {
            get
            {
                if (Session[SystemDefinition.SystemUser] != null)
                    return true;
                return false;
            }
        }
        public string CurrentPage
        {
            get
            {
                return Common.UrlHelper.CurrentPage(Request);
            }
        }
    }
}
